﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CharacterCreation.Data.Models;

namespace CharacterCreation.Data.Services {
    public class SpecialService : BaseService<Special, SpecialService> {
        public override void SaveCurrentItem() {
            save(this.CurrentItem);
        }

        public override void SaveNewItem() {
            var temp = this.NewItem;
            save(temp);
            this.Items.Add(temp);
            this.CurrentItem = temp;

            ClearNewItem();
        }

        private void save(Special special) {
            DataContext.Store(special.Statistics);
            DataContext.Store(special);
        }

        public override Special CreateNewItem() {
            return new Special() { Name = "new special", PriorityPointCost = 1, XPCost = 0, HasLevel = true, Description = "A new special" };
        }
    }
}
